# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=msgpuck
pkgver=2.0
pkgrel=1
pkgdesc="A simple and efficient MsgPack binary serialization library"
url="https://github.com/rtsisyk/msgpuck"
arch="all !x86"
license="BSD-2-Clause"
makedepends="cmake doxygen"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/rtsisyk/$pkgname/archive/$pkgver.tar.gz
	fix-possible-integer-overflow-in-mp_check.patch"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"

	cmake \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_VERBOSE_MAKEFILE=ON
	make all man
}

check() {
	cd "$builddir"
	make test
}

package() {
	cd "$builddir"

	make install DESTDIR="$pkgdir"

	mkdir -p "$pkgdir"/usr/share/man
	cp -a doc/man/* "$pkgdir"/usr/share/man/
}

sha512sums="54c5d1dab6a61039147864e525829a829f039f420b7804052045bffb672127953260b59243a7e78b5fc008c1e418622e7b17e32d431bf382a101dbd8725784a2  msgpuck-2.0.tar.gz
c2c92df850a6f2f593f3737b7847a3c165656bd56868bb3b6db7bd6561de029259d27fe71504835e3eaa9cd76965ff6afc32a898a55318d0ae035440cca66285  fix-possible-integer-overflow-in-mp_check.patch"
